//
//  BLUserTagView.m
//  Byelone
//
//  Created by Qi Liu on 2021/2/17.
//

#import "BLUserTagView.h"
#import "UILabel+Size.h"

@interface BLUserTagView ()

@property(nonatomic,assign)TagViewType tagType;

@end

@implementation BLUserTagView

+(BLUserTagView *)createTagWithType:(TagViewType)type{
    BLUserTagView * tagView = [[BLUserTagView alloc]init];
    tagView.tagType = type;
    return tagView;
}

-(instancetype)init{
    if (self = [super init]) {
        _leftImageView = [[UIImageView alloc]init];
        _contentLabel = [[UILabel alloc]init];
        _contentLabel.textColor = [UIColor whiteColor];
        _contentLabel.textAlignment = NSTextAlignmentCenter;
        _contentLabel.font = [UIFont systemFontOfSize:9];
        [self addSubview:_leftImageView];
        [self addSubview:_contentLabel];
        self.layer.cornerRadius = 7;
        self.layer.masksToBounds = YES;
    }
    return self;
}

-(void)setBaseinfoModel:(UserHomeBaseVo *)baseinfoModel{
    if (_tagType == TagViewType_Sex) {
        if ([baseinfoModel.gender integerValue] == 1) {
            _leftImageView.image = [UIImage imageNamed:@"common_girl"];
        }else{
            _leftImageView.image = [UIImage imageNamed:@"common_boy"];
        }
        _contentLabel.text = baseinfoModel.age;
        self.backgroundColor = [UIColor chColorWithHexString:@"#FD5680"];
        
    }else if (_tagType == TagViewType_Location){
        _leftImageView.image = [UIImage imageNamed:@"common_location"];
        _contentLabel.text = [NSString stringWithFormat:@"%@-%@",baseinfoModel.livingAreaName,baseinfoModel.livingCityName];
        self.backgroundColor = [UIColor chColorWithHexString:@"#56BDFF"];
    }
    
}

-(void)getTagViewWWith:(UserHomeBaseVo *)model{
    
}

@end
